Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add simple writeStackTrace for JS backend #16016

Merged
merged 3 commits into from
Nov 24, 2020
Merged

Conversation

ringabout
Copy link
Member

May be helpful for #15645

After this PR, panics flag is ignored silently.

@cooldome
Copy link
Member

Some kind of test is needed

@Araq Araq merged commit 19e2248 into nim-lang:devel Nov 24, 2020
@timotheecour
Copy link
Member

timotheecour commented Nov 24, 2020

After this PR, panics flag is ignored silently.

this isn't correct (nor should panics flag be ignored for js, it should behave as for c IMO for consistency).

proc main()=
  doAssertRaises(AssertionDefect):
    doAssert false
main()
nim r main # ok
nim r -b:js main # ok
nim r --panics:on main # ok: crashes as expected
nim r --panics:on main # not like `nim r -b:js main`, but also not ok:

this gives:

Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11363.nim(10) at module t11363
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11363.nim(7) at t11363.main
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assertions.nim(30) at assertions.failedAssertImpl
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assertions.nim(23) at assertions.raiseAssert
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(45) at sysFatal.sysFatal
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(33) at sysFatal.sysFatal
Traceback (most recent call last)
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11363.nim(10) at module t11363
/Users/timothee/git_clone/nim/timn/tests/nim/all/t11363.nim(109) at t11363.main
/Users/timothee/git_clone/nim/Nim_devel/lib/system/assertions.nim(23) at assertions.raiseAssert
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(45) at sysFatal.sysFatal
/Users/timothee/git_clone/nim/Nim_devel/lib/system/fatal.nim(33) at sysFatal.sysFatal
/Users/timothee/git_clone/nim/timn/build/nimcache/t11363.js:486
    rawWrite(stderr, toJSStr(buf_218103886));
             ^

ReferenceError: stderr is not defined

which also re-inforces what I mentioned here: #16016 (review)

ringabout added a commit to ringabout/Nim that referenced this pull request Nov 25, 2020
* add simple writeStackTrace for JS backend

* add testcase for writeStackTrace

* changelog
mildred pushed a commit to mildred/Nim that referenced this pull request Jan 11, 2021
* add simple writeStackTrace for JS backend

* add testcase for writeStackTrace

* changelog
ardek66 pushed a commit to ardek66/Nim that referenced this pull request Mar 26, 2021
* add simple writeStackTrace for JS backend

* add testcase for writeStackTrace

* changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants